﻿CREATE TABLE [dbo].[Tag]
(
	[Id] BIGINT NOT NULL IDENTITY(1,1) PRIMARY KEY, 
    [Name] NVARCHAR(MAX) NOT NULL, 
	[Guid] UNIQUEIDENTIFIER NOT NULL,
    [ClusterId] INT NOT NULL, 
    [Type] INT NOT NULL,
    [ParameterSchema] XML NULL, 
    [UnitId] INT NULL, 
    CONSTRAINT [FK_TagToCluster] FOREIGN KEY ([ClusterId]) REFERENCES [Cluster]([Id]), 
    CONSTRAINT [FK_TagToUnit] FOREIGN KEY ([UnitId]) REFERENCES [Unit]([Id])
)
